<?php


namespace addon\hotel\event;

use addon\hotel\model\OrderCommon;
use app\model\hotel\Hotel;


/**
 *
 */
class CronHotelOrderComplete
{

    public function handle($data)
    {
        $order = new OrderCommon();
        $order_info_result = $order->getOrderInfo([ [ "order_id", "=", $data[ "relate_id" ] ] ], "order_status,member_id");
        if (!empty($order_info_result) && $order_info_result[ "data" ][ "order_status" ] == 4) {

            $close_condition = array (
                [ 'order_id', '=', $data[ "relate_id" ] ],
            );
            $result = $order->orderComplete($close_condition);//订单自动关闭
            return $result;
        }
    }
}